package com.exception;
import com.vo.ResponseVO;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

@ControllerAdvice
public class SystemExceptionHandler {

    @ExceptionHandler(RuntimeException.class)
    @ResponseBody
    public ResponseVO handlerRuntimeException(RuntimeException runtimeException){
        System.out.println(runtimeException.getMessage());
        ResponseVO responseVO = new ResponseVO();
        responseVO.setCode("500");
        responseVO.setMsg("服务器异常");
        return responseVO;
    }
}
